package com.example.gzysmartcity.ui.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.gzysmartcity.R;
import com.example.gzysmartcity.repository.model.PositionUesr;

import org.jetbrains.annotations.NotNull;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Locale;

public class PositionRvAdapter extends BaseQuickAdapter<PositionUesr, BaseViewHolder> {
    List<String> typeName=new ArrayList<>(Arrays.asList("汽车工程师","汽车工人","技术人员","质检人员"));
    public PositionRvAdapter(int layoutResId) {
        super(layoutResId);
        mSimpleDateFormat=new SimpleDateFormat("yyyy年MM月dd日", Locale.CHINA);
    }
    private SimpleDateFormat mSimpleDateFormat;

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, PositionUesr positionUesr) {
        baseViewHolder.setText(R.id.rv_position_name,positionUesr.getPositionName());
        baseViewHolder.setText(R.id.rv_position_num,"数量："+positionUesr.getNum());
        baseViewHolder.setText(R.id.rv_position_line,"生产线："+positionUesr.getLineName());
        baseViewHolder.setText(R.id.rv_position_time,mSimpleDateFormat.format(new Date((long)positionUesr.getTime())));
        baseViewHolder.setText(R.id.rv_position_type,"工作类型："+typeName.get(positionUesr.getType()));

    }
}
